(function() {
    var myApp = angular.module('myApp');

    //角色列表
    myApp.constant("myRoleTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        paging     : true,
        scroller   : true,
        select     : true,
        searchDelay: 1000,
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            { data: 'name'   },
            { data: 'descr'  },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });

    //设置角色用户
    myApp.constant("myUserTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        paging     : true,
        scroller   : true,
        select     : true,
        order      : [[0, 'desc']],
        searchDelay: 1000,
        pageLength : 1000,
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            {
                data: 'selected',
                searchable: false,
                className: 'select-checkbox',
                render : function ( data, type, row, meta ) {
                    return '';
                }
            },
            { data: 'username' 	},
            { data: 'cname' },
            { data: 'email' },
            { data: 'telephone' },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });

    //设置角色权限
    myApp.constant("myPermissionTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        scroller   : true,
        select     : true,
        searchDelay: 1000,
        order      : [[0, 'desc']],
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            { data: 'name'},
            { data: 'descr'   },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });

    //添加权限列表
    myApp.constant("selectqxTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        scroller   : true,
        select     : true,
        searchDelay: 1000,
        order      : [[0, 'desc']],
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            {
               
                    data: 'selected',
                    searchable: false,
                    className: 'select-checkbox',
                    render : function ( data, type, row, meta ) {
                        return '';
                    }
            },
            { data: 'name'},
            { data: 'descr'   },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });


    //设置角色用户列表
    myApp.constant("myRoleUserListTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        paging     : true,
        scroller   : true,
        select     : true,
        order      : [[0, 'desc']],
        searchDelay: 1000,
        pageLength : 1000,
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            { data: 'username'  },
            { data: 'cname' },
            { data: 'email' },
            { data: 'telephone' },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });

    // 选中用户
    myApp.constant("selectUserTableOption", {
        dom        : 'ftir',
        processing : true,
        serverSide : true,
        deferRender: true,
        scrollY    : '100%',
        paging     : true,
        scroller   : true,
        select     : true,
        order      : [[1, 'desc']],
        searchDelay: 1000,
        pageLength : 1000,
        language   : { url: '../../pub/datatables/zh_cn.json' },
        columns    : [
            {
                data: 'selected',
                searchable: false,
                className: 'select-checkbox',
                render : function ( data, type, row, meta ) {
                    return '';
                }
            },
            { data: 'username'  },
            { data: 'cname' },
            { data: 'email' },
            { data: 'telephone' },
            {
                data: 'status',
                render : function ( data, type, row, meta ) {
                    return data == 1 ? '启用' : '禁用';
                }
            }
        ]
    });

})();


